package me.pra.melo.array.copy;

import java.util.Arrays;

public class Main {

    public static void main(String[] args) {

        int a [] = {0,1,2,3,4,5,6,7,8,9};

        int b [] = {10,11,12,13,14,15,16,17,18,19};

        int[] x = new  int[20] ;

        // System.arraycopy(源数组，源数组起始下标，目标数组，目标数组起始下标，要复制的长度 )
        System.arraycopy(b,0,x,0,3);

        System.out.println(Arrays.toString(x));
        // Arrays.copyOf(源数组,要拷贝的长度)
        int[] y =  Arrays.copyOf(a,5);

        System.out.println(Arrays.toString(y));
    }

}
